Page({
  data: {
    src: ''
  },
  onLoad(option) {
    console.log(option.verifyPageUrl,"option")
    console.log(decodeURIComponent(option.verifyPageUrl),'option22')
    // option.userAgent = option.userAgent.replace("LeftKuoHao", "(").replace("RightKuoHao", ")")
    // var verifyUserAgent = encodeURIComponent(option.userAgent).replace("(", "LeftKuoHao").replace(")", "RightKuoHao");
    this.setData({
      // requestCode: option.requestCode,
      // userAgent: option.userAgent,
      // shopId: option.shopId,
      // dpid: option.dpid,
      // src: `http://bi.doqtech.com.cn/dp/verify.html?requestCode=${option.requestCode}&userAgent=${verifyUserAgent}`
      src:decodeURIComponent(option.verifyPageUrl)
    })
  },
  onMsg(msg) {
    console.log(msg)
    return
    // let queryData = msg.detail.f.split('&');
    // let qData = {};
    // queryData.forEach(item=>{
    //     let kv = item.split('=');
    //     qData[kv[0]] = kv[1];
    // })
    // console.log(qData);
    // dd.httpRequest({
    //   headers: {
    //     "Content-Type": "application/x-www-form-urlencoded",
    //     "Accept": "*/*",
    //     "Accept-Language": "zh-CN,zh;q=0.9",
    //     "Connection": "keep-alive",
    //     "Accept-Encoding": "gzip, deflate, br",
    //     "Host": "verify.meituan.com",
    //     "Referer": "https://verify.meituan.com/v2/app/general_page?action=spiderindefence&requestCode="+this.data.requestCode+"&platform=1000&adaptor=auto&succCallbackUrl=https://optimus-mtsi.meituan.com/optimus/verifyResult",
    //     "Pragma": "no-cache",
    //     "Cache-Control": "no-cache",
    //     "User-Agent": this.data.userAgent,
    //   },
    //   url: 'http://verify.meituan.com/v2/ext_api/spiderindefence/verify',
    //   method: 'POST',
    //   data: qData,
    //   success: (res) => {
    //     console.log(res,'success_res')
    //     if (res.data.status === 1) {
    //         dd.redirectTo({
    //           url: `/pages/privateCustomers/add-private-customer/add-private-customer?shopId=${this.data.shopId}&dpid=${this.data.dpid}`
    //         })
    //     } else {
    //       dd.redirectTo({
    //         // url: `/pages/privateCustomers/verfify/verfify?requestCode=${this.data.requestCode}&userAgent=${ this.data.userAgent}`
    //         url: this.data.src
    //       })
    //     }
    //   },
    //   fail: (err) => {
    //     console.log(err,"err_verify.meituan.com.cn_err")
    //     dd.redirectTo({
    //       // url: `/pages/privateCustomers/verfify/verfify?requestCode=${this.data.requestCode}&userAgent=${this.data.userAgent}`
    //        url: this.data.src
    //     })
    //   }
    // })
  }
});
